class User < ActiveRecord::Base
  acts_as_authentic

  has_and_belongs_to_many :roles

  has_many :temp_examination_resoults
  has_many :examination_resoults
  has_many :patient_datas
  has_many :order_examinations

  validates_presence_of :first_name, :last_name

  
    def to_label
      last_name.nil? ? first_name : first_name + " " + last_name
    end

  def name
      last_name.nil? ? first_name : first_name + " " + last_name
    end

  class << self
    HUMANIZED_ATTRIBUTE_KEY_NAMES = {
      "first_name" => "pole imie",
      "last_name" => "pole nazwisko",
      "login" => "pole login",
      "phone_number" => "pole numer telefonu",
      "email_adress"  => "pole adres e-mail" ,
      "password"  => "pole haslo" ,
      "password_confirmation"  => "pole potwierdzenie hasla" ,

      
    }
    def human_attribute_name(attribute_key_name)
      HUMANIZED_ATTRIBUTE_KEY_NAMES[attribute_key_name] || super
    end
  end

end
